package com.dataseek.iot.core.enums;


/**
 * @author cc
 * @Title: 报警类型
 * @Description: 报警类型
 * @date 2021/10/114:59 下午
 * @since 1.0
 */
public enum AlarmType {

    HighAlarm("高限报警", "highAlarm", 0),
    LowAlarm("低限报警", "lowAlarm", 1),
    PosAlarm("变位报警", "posAlarm",2),
    NoAlarm("报警恢复", "noAlarm", 3);


     private String name;

     private String type;

     private Integer num;

     AlarmType(String name, String type, Integer num){
         this.name = name;
         this.type = type;
         this.num  = num;
     }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }


    public static String getTextByCode(String code){
        //values() 会获取定义的 enum对象
        for(AlarmType item : values()){
            if(item.getType().equals(code)){
                return item.getName();
            }
        }
        return null;
    }

}
